package com.intertid

import com.mongodb.casbah.commons.MongoDBObject
import com.mongodb.DBObject
import com.mongodb.util.JSON
import net.sf.json.JSONObject
import org.bson.types.ObjectId
import com.mongodb.casbah.MongoCollection
import com.mongodb.casbah.query._
import com.mongodb.casbah.query.dsl._
import net.sf.json.JsonConfig
import com.intertid.mongodb.error._

package object mongodb {

  def empty = MongoDBObject.empty

  def dberror(errorcode: Int, msg: String = null) = throw new MongoDBException(errorcode, msg);

  implicit def serializabler(data: Object) = {
    new {
      def toJson: String = {
        val jsonConfig = new JsonConfig;

        JSONObject.fromObject(data).toString();
      }

    }
  }

}